<template>
  <div class="container">
    <div class="flex flex-wrap f-ptp10">
      <el-input class='f-mrt20 f-mbt10 f-w120' v-model="phone" placeholder="项目ID"></el-input>
      <el-input class='f-mrt20 f-mbt10 f-w120' v-model="phone" placeholder="项目名称"></el-input>
      <el-select class='f-mrt20 f-mbt10 f-w120' v-model="vip" clearable placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.value"
          :label="item.label"
          :value="item.value">
        </el-option>
      </el-select>
      <el-input class='f-mrt20 f-mbt10 f-w120' v-model="createTime" placeholder="发生时间开始-结束"></el-input>
      <el-button class='f-h40' @click="search" type="primary">查询</el-button>
      <el-button class='f-h40' @click="addProjectBtnClickEvent" type="primary">新增项目</el-button>
    </div>
    <div>
      <el-table
        :data="tableData"
        border
        style="width: 100%">
        <el-table-column prop="issueType" label="项目ID" width="180"></el-table-column>
        <el-table-column prop="phone" label="项目名称" width="180"></el-table-column>
        <el-table-column prop="region" label="募集金额" width="180"></el-table-column>
        <el-table-column prop="region" label="已募集金额" width="180"></el-table-column>
        <el-table-column prop="createTime" label="发生时间" width="180"></el-table-column>
        <el-table-column prop="createTime" label="当前状态" width="180"></el-table-column>
        <el-table-column prop="manage" label="管理">
          <template slot-scope="scope">
            <el-button
              size="mini"
              @click="editBtnClickEvent(scope.$index, scope.row)">编 辑</el-button>
            <el-button
              size="mini"
              @click="addBtnClickEvent(scope.$index, scope.row)">添加进度</el-button>
            <el-button
              size="mini"
              @click="showDetailBtnClickEvent(scope.$index, scope.row)">项目详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage1"
          :page-size="100"
          layout="total, prev, pager, next"
          :total="1000">
        </el-pagination>
      </div>
    </div>

    <!-- 新增项目 -->
    <el-dialog
      title="新增项目"
      :visible.sync="showAddProject"
      width="30%"
      :before-close="handleClose">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showAddProject = false">取 消</el-button>
        <el-button type="primary" @click="showAddProject = false">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 编辑项目 -->
    <el-dialog
      title="编辑项目"
      :visible.sync="showEditProject"
      width="30%"
      :before-close="handleClose">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showEditProject = false">取 消</el-button>
        <el-button type="primary" @click="showEditProject = false">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 添加项目进度 -->
    <el-dialog
      title="添加进度"
      :visible.sync="showAddProgress"
      width="30%"
      :before-close="handleClose">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showAddProgress = false">取 消</el-button>
        <el-button type="primary" @click="showAddProgress = false">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 项目详情 -->
    <el-dialog
      title="项目详情"
      :visible.sync="showProDetail"
      width="30%"
      :before-close="handleClose">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showProDetail = false">取 消</el-button>
        <el-button type="primary" @click="showProDetail = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'PublicWelfareManage',
  data() {
    return {
      showAddProject: false,
      showEditProject: false,
      showAddProgress: false,
      showProDetail: false,
      phone: '',
      password: '',
      tableData: [
        {
          userCode: '2016-05-02',
          phone: '18098758888',
          name: '王小虎',
          idCard: '330326199908080606',
          accountBalance: 5000.00,
          vip: 1,
          createTime: '2018-12-30'
        }, {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        }, {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        }, {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  },
  methods: {
    addProjectBtnClickEvent() {
      this.showAddProject = true;
    },
    editBtnClickEvent(index, pro) {
      console.log('index:::', index);
      console.log('pro::', pro);
      this.showEditProject = true
    },
    addBtnClickEvent(index, pro) {
       console.log('index:::', index);
      console.log('pro::', pro);
      this.showAddProgress = true
    },
    showDetailBtnClickEvent(index, pro) {
       console.log('index:::', index);
      console.log('pro::', pro);
      this.showProDetail = true
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.top{
  /* display: flex; */
  overflow: hidden;
  padding: 10px 0;
}
.top-item{
  float: left;
  margin-right: 20px;
}
.w-120{
  width: 120px;
}
.w-200{
  width: 200px;
}
</style>
